/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package tef.project.expressions.provider;

import java.util.ArrayList;
import java.util.Collection;

import org.eclipse.emf.common.notify.Adapter;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.Notifier;

import org.eclipse.emf.edit.provider.ChangeNotifier;
import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
import org.eclipse.emf.edit.provider.IChangeNotifier;
import org.eclipse.emf.edit.provider.IDisposable;
import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
import org.eclipse.emf.edit.provider.IItemLabelProvider;
import org.eclipse.emf.edit.provider.IItemPropertySource;
import org.eclipse.emf.edit.provider.INotifyChangedListener;
import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
import org.eclipse.emf.edit.provider.ITreeItemContentProvider;

import tef.project.expressions.util.ExpressionsAdapterFactory;

/**
 * This is the factory that is used to provide the interfaces needed to support Viewers.
 * The adapters generated by this factory convert EMF adapter notifications into calls to {@link #fireNotifyChanged fireNotifyChanged}.
 * The adapters also support Eclipse property sheets.
 * Note that most of the adapters are shared among multiple instances.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public class ExpressionsItemProviderAdapterFactory extends ExpressionsAdapterFactory implements ComposeableAdapterFactory, IChangeNotifier, IDisposable {
	/**
	 * This keeps track of the root adapter factory that delegates to this adapter factory.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected ComposedAdapterFactory parentAdapterFactory;

	/**
	 * This is used to implement {@link org.eclipse.emf.edit.provider.IChangeNotifier}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected IChangeNotifier changeNotifier = new ChangeNotifier();

	/**
	 * This keeps track of all the supported types checked by {@link #isFactoryForType isFactoryForType}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected Collection supportedTypes = new ArrayList();

	/**
	 * This constructs an instance.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ExpressionsItemProviderAdapterFactory() {
		supportedTypes.add(IEditingDomainItemProvider.class);
		supportedTypes.add(IStructuredItemContentProvider.class);
		supportedTypes.add(ITreeItemContentProvider.class);
		supportedTypes.add(IItemLabelProvider.class);
		supportedTypes.add(IItemPropertySource.class);
	}

	/**
	 * This keeps track of the one adapter used for all {@link tef.project.expressions.Implies} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected ImpliesItemProvider impliesItemProvider;

	/**
	 * This creates an adapter for a {@link tef.project.expressions.Implies}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Adapter createImpliesAdapter() {
		if (impliesItemProvider == null) {
			impliesItemProvider = new ImpliesItemProvider(this);
		}

		return impliesItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link tef.project.expressions.Or} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected OrItemProvider orItemProvider;

	/**
	 * This creates an adapter for a {@link tef.project.expressions.Or}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Adapter createOrAdapter() {
		if (orItemProvider == null) {
			orItemProvider = new OrItemProvider(this);
		}

		return orItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link tef.project.expressions.And} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected AndItemProvider andItemProvider;

	/**
	 * This creates an adapter for a {@link tef.project.expressions.And}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Adapter createAndAdapter() {
		if (andItemProvider == null) {
			andItemProvider = new AndItemProvider(this);
		}

		return andItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link tef.project.expressions.Neg} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected NegItemProvider negItemProvider;

	/**
	 * This creates an adapter for a {@link tef.project.expressions.Neg}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Adapter createNegAdapter() {
		if (negItemProvider == null) {
			negItemProvider = new NegItemProvider(this);
		}

		return negItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link tef.project.expressions.Model} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected ModelItemProvider modelItemProvider;

	/**
	 * This creates an adapter for a {@link tef.project.expressions.Model}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Adapter createModelAdapter() {
		if (modelItemProvider == null) {
			modelItemProvider = new ModelItemProvider(this);
		}

		return modelItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link tef.project.expressions.Feature} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected FeatureItemProvider featureItemProvider;

	/**
	 * This creates an adapter for a {@link tef.project.expressions.Feature}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Adapter createFeatureAdapter() {
		if (featureItemProvider == null) {
			featureItemProvider = new FeatureItemProvider(this);
		}

		return featureItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link tef.project.expressions.All} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected AllItemProvider allItemProvider;

	/**
	 * This creates an adapter for a {@link tef.project.expressions.All}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Adapter createAllAdapter() {
		if (allItemProvider == null) {
			allItemProvider = new AllItemProvider(this);
		}

		return allItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link tef.project.expressions.Number} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected NumberItemProvider numberItemProvider;

	/**
	 * This creates an adapter for a {@link tef.project.expressions.Number}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Adapter createNumberAdapter() {
		if (numberItemProvider == null) {
			numberItemProvider = new NumberItemProvider(this);
		}

		return numberItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link tef.project.expressions.Any} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected AnyItemProvider anyItemProvider;

	/**
	 * This creates an adapter for a {@link tef.project.expressions.Any}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Adapter createAnyAdapter() {
		if (anyItemProvider == null) {
			anyItemProvider = new AnyItemProvider(this);
		}

		return anyItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link tef.project.expressions.ComparisonOperator} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected ComparisonOperatorItemProvider comparisonOperatorItemProvider;

	/**
	 * This creates an adapter for a {@link tef.project.expressions.ComparisonOperator}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Adapter createComparisonOperatorAdapter() {
		if (comparisonOperatorItemProvider == null) {
			comparisonOperatorItemProvider = new ComparisonOperatorItemProvider(this);
		}

		return comparisonOperatorItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link tef.project.expressions.GE} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected GEItemProvider geItemProvider;

	/**
	 * This creates an adapter for a {@link tef.project.expressions.GE}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Adapter createGEAdapter() {
		if (geItemProvider == null) {
			geItemProvider = new GEItemProvider(this);
		}

		return geItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link tef.project.expressions.G} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected GItemProvider gItemProvider;

	/**
	 * This creates an adapter for a {@link tef.project.expressions.G}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Adapter createGAdapter() {
		if (gItemProvider == null) {
			gItemProvider = new GItemProvider(this);
		}

		return gItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link tef.project.expressions.LE} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected LEItemProvider leItemProvider;

	/**
	 * This creates an adapter for a {@link tef.project.expressions.LE}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Adapter createLEAdapter() {
		if (leItemProvider == null) {
			leItemProvider = new LEItemProvider(this);
		}

		return leItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link tef.project.expressions.L} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected LItemProvider lItemProvider;

	/**
	 * This creates an adapter for a {@link tef.project.expressions.L}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Adapter createLAdapter() {
		if (lItemProvider == null) {
			lItemProvider = new LItemProvider(this);
		}

		return lItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link tef.project.expressions.E} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected EItemProvider eItemProvider;

	/**
	 * This creates an adapter for a {@link tef.project.expressions.E}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Adapter createEAdapter() {
		if (eItemProvider == null) {
			eItemProvider = new EItemProvider(this);
		}

		return eItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link tef.project.expressions.D} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected DItemProvider dItemProvider;

	/**
	 * This creates an adapter for a {@link tef.project.expressions.D}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Adapter createDAdapter() {
		if (dItemProvider == null) {
			dItemProvider = new DItemProvider(this);
		}

		return dItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link tef.project.expressions.ComparisonOperand} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected ComparisonOperandItemProvider comparisonOperandItemProvider;

	/**
	 * This creates an adapter for a {@link tef.project.expressions.ComparisonOperand}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Adapter createComparisonOperandAdapter() {
		if (comparisonOperandItemProvider == null) {
			comparisonOperandItemProvider = new ComparisonOperandItemProvider(this);
		}

		return comparisonOperandItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link tef.project.expressions.Quantity} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected QuantityItemProvider quantityItemProvider;

	/**
	 * This creates an adapter for a {@link tef.project.expressions.Quantity}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Adapter createQuantityAdapter() {
		if (quantityItemProvider == null) {
			quantityItemProvider = new QuantityItemProvider(this);
		}

		return quantityItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link tef.project.expressions.Function} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected FunctionItemProvider functionItemProvider;

	/**
	 * This creates an adapter for a {@link tef.project.expressions.Function}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Adapter createFunctionAdapter() {
		if (functionItemProvider == null) {
			functionItemProvider = new FunctionItemProvider(this);
		}

		return functionItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link tef.project.expressions.Count} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected CountItemProvider countItemProvider;

	/**
	 * This creates an adapter for a {@link tef.project.expressions.Count}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Adapter createCountAdapter() {
		if (countItemProvider == null) {
			countItemProvider = new CountItemProvider(this);
		}

		return countItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link tef.project.expressions.QuantifyOperator} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected QuantifyOperatorItemProvider quantifyOperatorItemProvider;

	/**
	 * This creates an adapter for a {@link tef.project.expressions.QuantifyOperator}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Adapter createQuantifyOperatorAdapter() {
		if (quantifyOperatorItemProvider == null) {
			quantifyOperatorItemProvider = new QuantifyOperatorItemProvider(this);
		}

		return quantifyOperatorItemProvider;
	}

	/**
	 * This returns the root adapter factory that contains this factory.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ComposeableAdapterFactory getRootAdapterFactory() {
		return parentAdapterFactory == null ? this : parentAdapterFactory.getRootAdapterFactory();
	}

	/**
	 * This sets the composed adapter factory that contains this factory.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setParentAdapterFactory(ComposedAdapterFactory parentAdapterFactory) {
		this.parentAdapterFactory = parentAdapterFactory;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public boolean isFactoryForType(Object type) {
		return supportedTypes.contains(type) || super.isFactoryForType(type);
	}

	/**
	 * This implementation substitutes the factory itself as the key for the adapter.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Adapter adapt(Notifier notifier, Object type) {
		return super.adapt(notifier, this);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Object adapt(Object object, Object type) {
		if (isFactoryForType(type)) {
			Object adapter = super.adapt(object, type);
			if (!(type instanceof Class) || (((Class)type).isInstance(adapter))) {
				return adapter;
			}
		}

		return null;
	}

	/**
	 * This adds a listener.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void addListener(INotifyChangedListener notifyChangedListener) {
		changeNotifier.addListener(notifyChangedListener);
	}

	/**
	 * This removes a listener.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void removeListener(INotifyChangedListener notifyChangedListener) {
		changeNotifier.removeListener(notifyChangedListener);
	}

	/**
	 * This delegates to {@link #changeNotifier} and to {@link #parentAdapterFactory}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void fireNotifyChanged(Notification notification) {
		changeNotifier.fireNotifyChanged(notification);

		if (parentAdapterFactory != null) {
			parentAdapterFactory.fireNotifyChanged(notification);
		}
	}

	/**
	 * This disposes all of the item providers created by this factory. 
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void dispose() {
		if (impliesItemProvider != null) impliesItemProvider.dispose();
		if (orItemProvider != null) orItemProvider.dispose();
		if (andItemProvider != null) andItemProvider.dispose();
		if (negItemProvider != null) negItemProvider.dispose();
		if (modelItemProvider != null) modelItemProvider.dispose();
		if (featureItemProvider != null) featureItemProvider.dispose();
		if (allItemProvider != null) allItemProvider.dispose();
		if (numberItemProvider != null) numberItemProvider.dispose();
		if (anyItemProvider != null) anyItemProvider.dispose();
		if (comparisonOperatorItemProvider != null) comparisonOperatorItemProvider.dispose();
		if (geItemProvider != null) geItemProvider.dispose();
		if (gItemProvider != null) gItemProvider.dispose();
		if (leItemProvider != null) leItemProvider.dispose();
		if (lItemProvider != null) lItemProvider.dispose();
		if (eItemProvider != null) eItemProvider.dispose();
		if (dItemProvider != null) dItemProvider.dispose();
		if (comparisonOperandItemProvider != null) comparisonOperandItemProvider.dispose();
		if (quantityItemProvider != null) quantityItemProvider.dispose();
		if (functionItemProvider != null) functionItemProvider.dispose();
		if (countItemProvider != null) countItemProvider.dispose();
		if (quantifyOperatorItemProvider != null) quantifyOperatorItemProvider.dispose();
	}

}
